package com.mofang.powerdekorhelper.adapter;

import android.content.Context;
import android.view.View;

import com.mofang.powerdekorhelper.R;
import com.mofang.powerdekorhelper.base.recycleview.BaseRecycleViewAdapter;
import com.mofang.powerdekorhelper.base.recycleview.BaseViewHolder;
import com.mofang.powerdekorhelper.model.CustomerDetail;

import java.util.List;

/**
 * Created by luofei on 2017/9/2 0002.
 * 说明：
 */

public class ActivityRecordAdapter extends BaseRecycleViewAdapter {

    IDetailCall iDetailCall;

    public void setiDetailCall(IDetailCall iDetailCall) {
        this.iDetailCall = iDetailCall;
    }

    public ActivityRecordAdapter(List<?> data, Context mContext, int layoutId) {
        super(data, mContext, layoutId);
    }

    @Override
    protected <T> void convert(BaseViewHolder holder, T bean, int position) {

        final CustomerDetail.CustomerActivity activity = (CustomerDetail.CustomerActivity) bean;

        holder.setText(R.id.activity_record_name_tv, activity.getActivityName());
        holder.setText(R.id.activity_record_time_tv, activity.getGeneralize_start() + "——" + activity.getGeneralize_end());
        holder.setImage(R.id.activity_record_imv, activity.getImgurl(), -1);

        holder.setOnclickListener(R.id.activity_record_detail_tv, new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                iDetailCall.Idetail(activity.getActivityId());
            }
        });
    }

    public interface IDetailCall {

        public void Idetail(Integer activityId);
    }
}
